#include<bits/stdc++.h>

using namespace std;

int a[1000];
//int book[1000];
int n = 7;
int dp[5000];

void dfs(int k) {
    int sum = 0;
    for (int j = 0; j <= k - 1; j++) {
        sum += a[j];
    }
    if (sum == n) {
        // copy(a, a + k, ostream_iterator<int>(cout, " "));
        //cout << endl;
        //n=a[0]+a[1]..+a[k-1]
        int tot = 0, pre = a[0];
        for (int i = 1; i < k; i++) {
            tot += a[i] * pre;
            pre += a[i];
        }
        // cout << "->" << tot << endl;
        dp[tot] = 1;
        return;
    }
    for (int i = 1; i <= n; i++) {
        if (sum + i > n)continue;
        if (k >= 1 && i < a[k - 1])continue;
        a[k] = i;
        dfs(k + 1);

    }

}

int main() {
    //利用整数分拆计算直线交点数（n条直线无三点共线可以形成几个交点)
    while (cin >> n) {
        memset(dp, 0, sizeof(dp));
        dfs(0);
        for (int j = 0; j <= n * (n - 1) / 2; j++) {
            if (dp[j] == 1) {
                cout << j << " ";
            }
        }
        cout << endl;
    }
    return 0;
}